
package tutorial.main.data;


import java.util.ArrayList;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import tutorial.entidades.Evento;

public class ProviderUsuario extends ContentProvider {

	public static final Uri CONTENT_URI = Uri
			.parse("content://tutorial.providerusuario");
	//public static final String COD_USUARIO = "cod_usuario";

	public static final String BUSCAR_ID = "buscar_id";

	public RegistroDataBaseHelper dBHelper;
	
	/*public static final String COUNTRIES_OF_CONTINENT = "countriesOfContinent";
	public static final String COUNTRY_OF_CONTINENT = "countryOfContinent";
	public static final String UPDATE_COUNTRY = "updateCountry";*/

	@Override
	public int delete(Uri uri, String selection, String[] selectionArgs) {
		return 0;
	}

	@Override
	public String getType(Uri uri) {
		return null;
	}

	@Override
	public Uri insert(Uri uri, ContentValues values) {
		
		dBHelper.insertarUsuario(values);
		
		return null;
	}

	@Override
	public boolean onCreate() {
		dBHelper = new RegistroDataBaseHelper(getContext());
		return dBHelper != null;
	}

	
	
	
	
	@Override
	public Cursor query(Uri uri, String[] projection, String selection,
			String[] selectionArgs, String sortOrder) {

		Cursor cursor = null;
		if (BUSCAR_ID.equals(selection)) 
		{
			
				cursor = dBHelper.buscarIdUsuario(selectionArgs[0]);
				if (selectionArgs.length == 1 && selectionArgs[0] != null) {
					cursor = dBHelper.buscarIdUsuario(selectionArgs[0]);
					
				}
			
		}

		return cursor;
	}
	
	/*@Override
	public int update(Uri uri, ContentValues values, String selection,
			String[] selectionArgs) {
		int result = Constants.RESULT_FAIL;

		if (UPDATE_COUNTRY.equals(selection)) {
			if (selectionArgs.length == 2 && selectionArgs[0] != null
					&& selectionArgs[1] != null) {

				int rows = dBHelper.updateCountry(selectionArgs[0],
						selectionArgs[1], values);
				if (rows == 1) {
					result = Constants.RESULT_OK;
				}
			}
		}
		return result;
	}*/
	@Override
	public int update(Uri uri, ContentValues values, String selection,
			String[] selectionArgs) {		
		return 0;
	}
}
